package com.hadwinling.blog.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.hadwinling.blog.entity.Comment;
import com.hadwinling.blog.mapper.CommentMapper;
import com.hadwinling.blog.service.CommentService;

import java.util.ArrayList;
import java.util.List;

/**
 * @author HadwinLing
 * @version V1.0
 * @Package com.hadwinling.blog.service.impl
 * @date 2020/8/19 7:47
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Resource
    private CommentMapper commentMapper;


    @Override
    public int deleteByPrimaryKey(Integer id) {
        return commentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Comment record) {
        return commentMapper.insert(record);
    }

    @Override
    public int insertSelective(Comment record) {
        return commentMapper.insertSelective(record);
    }

    @Override
    public Comment selectByPrimaryKey(Integer id) {
        return commentMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Comment record) {
        return commentMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Comment record) {
        return commentMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Comment> selectAllByArticleidOrderByCreatetimeDesc(Integer articleid) {
        return commentMapper.selectAllByArticleidOrderByCreatetimeDesc(articleid);
    }

    @Override
    public List<Comment> selectAllByParentcommentidOrderByCreatetimeDesc(Integer parentcommentid) {
        return commentMapper.selectAllByParentcommentidOrderByCreatetimeDesc(parentcommentid);
    }

    @Override
    public int updateCommentcountByParentcommentid(Integer parentcommentid) {
        return commentMapper.updateCommentcountByParentcommentid(parentcommentid);
    }


}






